package com.manage.platform.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.manage.platform.entity.TaskBudgetEntity;
import com.manage.platform.mapper.TaskBudgetMapper;
import com.manage.platform.vo.TaskBudgetVo;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * YWD
 * 2025/11/24
 */
@AllArgsConstructor
@Service
public class TaskBudgetServiceImpl extends ServiceImpl<TaskBudgetMapper, TaskBudgetEntity> {


    public TaskBudgetVo getByTaskId(Long id) {
        LambdaQueryWrapper<TaskBudgetEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper
                .eq(TaskBudgetEntity::getTaskId, id)
                .eq(TaskBudgetEntity::getIsDeleted, 0);
        TaskBudgetEntity entity = this.getOne(queryWrapper);
        return BeanUtil.copyProperties(entity, TaskBudgetVo.class);
    }


}
